<template>
	<div class="app-container2">
		<el-form
			ref="ruleForm"
			class="ruleForm"
			:model="ruleForm"
			label-width="80px"
			:inline="true"
		>
			<el-row>
				<el-form-item label="所属站点:">
					<el-date-picker
						v-model="value1"
						type="year"
						placeholder="选择年"
					>
					</el-date-picker>
				</el-form-item>
				<el-form-item label="标题:">
					<el-input
						v-model="ruleForm.name"
						placeholder="标题"
					></el-input>
				</el-form-item>
			</el-row>
			<el-row>
				<el-form-item label="栏目名称:">
					<!-- <el-checkbox-group v-model="ruleForm.type">
						<el-checkbox label="思想建设" name="type"></el-checkbox>
						<el-checkbox label="制度建设" name="type"></el-checkbox>
						<el-checkbox label="组织建设" name="type"></el-checkbox>
						<el-checkbox label="主题教育" name="type"></el-checkbox>
						<el-checkbox label="党建活动" name="type"></el-checkbox>
						<el-checkbox label="评先评优" name="type"></el-checkbox>
						<el-checkbox label="优秀党员" name="type"></el-checkbox>
					</el-checkbox-group> -->
					<el-checkbox-group v-model="ruleForm.type" size="medium">
						<el-checkbox-button
							v-for="city in cities"
							:label="city"
							:key="city"
							>{{ city }}</el-checkbox-button
						>
					</el-checkbox-group>
				</el-form-item>
			</el-row>
		</el-form>

		<div class="tableListOperator">
			<div class="leftBtns">
				<el-button
					type="primary"
					size="small"
					icon="el-icon-plus"
					@click="add"
					>新增</el-button
				>
			</div>
			<div class="rightBtns">
				<el-button size="small" plain>重置</el-button>
				<el-button type="primary" size="small">查询</el-button>
			</div>
		</div>
		<el-table :data="list" style="width: 100%" v-loading="loading">
			<el-table-column prop="date" label="所属栏目" align="center">
			</el-table-column>
			<el-table-column prop="date" label="标题" align="center">
			</el-table-column>
			<el-table-column prop="date" label="作者" align="center">
			</el-table-column>
			<el-table-column prop="date" label="设为幻灯" align="center">
			</el-table-column>
			<el-table-column prop="date" label="发布时间" align="center">
			</el-table-column>
			<el-table-column prop="date" label="排序" align="center">
			</el-table-column>

			<el-table-column label="操作" align="center">
				<template slot-scope="{ row }">
					<el-button type="text" @click="edit(row)">编辑</el-button>
					<el-button type="text" @click="del(row)">删除</el-button>
				</template>
			</el-table-column>
		</el-table>
		<pagination
			v-show="ruleForm.total > 0"
			:total="ruleForm.total"
			:page.sync="ruleForm.pageNum"
			:limit.sync="ruleForm.pageSize"
			@pagination="() => {}"
		/>
		<el-dialog
			:title="form.id ? '编辑咨询' : '新增咨询'"
			:visible.sync="dialogVisible"
			width="1200px"
		>
			<el-form
				:model="ruleForm"
				:rules="rules"
				ref="ruleForm"
				label-width="100px"
			>
				<el-row>
					<el-col :span="12">
						<el-form-item label="所属站点">
							<el-select style="width: 100%">
								<el-option value="1"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="栏目">
							<el-select
								placeholder="请选择栏目"
								style="width: 100%"
							>
								<el-option value="1"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="12">
						<el-form-item label="作者">
							<el-input placeholder="请输入作者" />
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="发布时间">
							<el-date-picker
								type="date"
								clearable
								placeholder="请选择发布时间"
								style="width: 100%"
							></el-date-picker>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="12">
						<el-form-item label="排序">
							<el-input-number
								controls-position="right"
							></el-input-number>
						</el-form-item>
					</el-col>
					<el-col :span="12"></el-col>
				</el-row>
				<el-form-item label="标题" prop="name">
					<el-input
						v-model="ruleForm.name"
						placeholder="请输入标题"
					></el-input>
				</el-form-item>
				<el-form-item label="副标题" prop="name">
					<el-input
						v-model="ruleForm.name"
						placeholder="请输入副标题"
					></el-input>
				</el-form-item>
				<el-row>
					<el-col :span="12">
						<el-form-item label="是否原创">
							<el-switch
								active-color="#ff4d4f"
								inactive-color="rgba(0,0,0,0.25)"
							>
							</el-switch>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="是否外部跳转">
							<el-switch
								active-color="#ff4d4f"
								inactive-color="rgba(0,0,0,0.25)"
							>
							</el-switch> </el-form-item
					></el-col>
				</el-row>
				<el-form-item label="数据驾驶舱文章标题" label-width="150px">
					<el-switch
						active-color="#ff4d4f"
						inactive-color="rgba(0,0,0,0.25)"
					>
					</el-switch>
				</el-form-item>
				<el-form-item label="封面图片">
					<el-upload
						class="avatar-uploader"
						action
						:show-file-list="false"
					>
						<img src="" v-show="false" class="avatar" />
						<i class="el-icon-plus avatar-uploader-icon"></i>
					</el-upload>
				</el-form-item>
				<el-form-item label="来源网站名称">
					<el-input placeholder="请输入来源网站名称"></el-input>
				</el-form-item>
				<el-form-item label="来源网站URL">
					<el-input placeholder="请输入来源网站URL">
						<el-select slot="prepend" placeholder="请选择">
							<el-option
								label="Http://"
								value="Http://"
							></el-option>
							<el-option
								label="Https://"
								value="Https://"
							></el-option>
						</el-select>
					</el-input>
				</el-form-item>
				<el-form-item label="">
					<div style="display: flex; justify-content: space-between">
						<el-checkbox> 是否幻灯片 </el-checkbox>
						<span
							>建议尺寸：530*380；大小200M以内；请将所有封面图片尺寸保持一致</span
						>
					</div>
				</el-form-item>
				<el-form-item label="资讯材料">
					<el-upload action>
						<el-button> 上传附件</el-button>
						<div slot="tip" class="el-upload__tip">
							支持扩展名：.doc .docx .pdf 大小200M以内
						</div>
					</el-upload>
				</el-form-item>
				<el-form-item label="音频文件">
					<el-switch> </el-switch>
				</el-form-item>
				<el-form-item label="视频文件">
					<el-switch> </el-switch>
				</el-form-item>
				<el-form-item label="内容">
					<editor :min-height="192" />
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible = false">取 消</el-button>
				<el-button type="primary" @click="dialogVisible = false"
					>确 定</el-button
				>
			</span>
		</el-dialog>
	</div>
</template>

<script>
// import { } from "@/api/card/home";
export default {
	data() {
		return {
			loading: false,
			value1: '',
			dialogVisible: false,
			list: [{}],
			ruleForm: {
				pageNum: 1,
				pageSize: 10,
				total: 0,
				type: [],
			},
			rules: {
				name: [
					{
						required: true,
						message: '请输入活动名称',
						trigger: 'blur',
					},
				],
			},
			cities: ['上海', '北京', '广州', '深圳'],
			form: {},
		}
	},
	methods: {
		submit() {},
		//切换分页
		handleCurrentChange(val) {
			this.loading = true
			this.ruleForm.pageNum = val
		},
		//切换总条数
		handleSizeChange(val) {
			this.loading = true
			this.ruleForm.pageSize = val
		},
		add() {
			this.dialogVisible = true
		},
		edit(row) {
			this.form = row
			this.dialogVisible = true
		},
		del(row) {
			this.$confirm(`删除后资讯将无法恢复！`, '您确定要删除该条资讯吗?', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning',
			})
				.then(() => {})
				.catch(() => {})
		},
	},
	created() {},
}
</script>

<style lang="scss" scoped>
.ruleForm {
	::v-deep .el-checkbox-button {
		margin-right: 10px;
	}
	::v-deep .el-checkbox-button__inner {
		border-radius: 4px;
		border-left: 1px solid #ddd;
	}
}
.avatar-uploader {
	::v-deep .el-upload {
		border: 1px dashed #d9d9d9 !important;
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
		&:hover {
			border-color: #ff4d4f !important;
		}
	}
	.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 140px;
		height: 140px;
		line-height: 140px;
		text-align: center;
	}
	.avatar {
		width: 140px;
		height: 140px;
		display: block;
	}
}
</style>
